using System;
using System.Diagnostics;
using IBNet.UtilsDataStructuresAndExtensions;

namespace IBNet
{
   /// <summary>
   /// Real Time Bar Event Arguments
   /// </summary>
   public class RealTimeBarEventArgs : EventArgs
   {
      private readonly int requestId;
      private readonly long openTimeSince1970;
      //private readonly DateTime openTime;
      private readonly decimal open;
      private readonly decimal high;
      private readonly decimal low;
      private readonly decimal close;
      private readonly long volume;
      private readonly decimal wap;
      private readonly int trades;

      /// <summary>
      /// Creates a new RealTimeBarEventArgs.
      /// </summary>
      /// <param name="requestId">The request Id.</param>
      /// <param name="openTimeSince1970">The date-time stamp of the start of the bar.</param>
      /// <param name="open">The opening price.</param>
      /// <param name="high">The high price.</param>
      /// <param name="low">The low price.</param>
      /// <param name="close">The close price.</param>
      /// <param name="volume">The volume.</param>
      /// <param name="wap">The weighted average price.</param>
      /// <param name="trades">The number of trades.</param>
      public RealTimeBarEventArgs(int requestId, long openTimeSince1970, decimal open,
         decimal high, decimal low, decimal close, long volume, decimal wap, int trades)
      {
         this.requestId = requestId;
         this.openTimeSince1970 = openTimeSince1970;
         //this.openTime = openTimeSince1970.ConvertTo1970DateTime();
         this.open = open;
         this.high = high;
         this.low = low;
         this.close = close;
         this.volume = volume;
         this.wap = wap;
         this.trades = trades;
      }

      /// <summary>
      /// Gets the request Id.
      /// </summary>
      public int RequestId
      {
         get { return requestId; }
      }

      ///// <summary>
      ///// Gets the open time of the bar.
      ///// </summary>
      //public DateTime OpenTime
      //{
      //   get { return openTime; }
      //}

      /// <summary>
      /// Gets open time of the bar in seconds since 1970.
      /// </summary>
      public long OpenTimeSince1970
      {
         get { return openTimeSince1970; }
      }

      /// <summary>
      /// Gets the open price.
      /// </summary>
      public decimal Open
      {
         get { return open; }
      }

      /// <summary>
      /// Gets the high price.
      /// </summary>
      public decimal High
      {
         get { return high; }
      }

      /// <summary>
      /// Gets the low price.
      /// </summary>
      public decimal Low
      {
         get { return low; }
      }

      /// <summary>
      /// Gets the close price.
      /// </summary>
      public decimal Close
      {
         get { return close; }
      }

      /// <summary>
      /// Gets the volume.
      /// </summary>
      public long Volume
      {
         get { return volume; }
      }

      /// <summary>
      /// Gets the weighted average price.
      /// </summary>
      public decimal Wap
      {
         get { return wap; }
      }

      /// <summary>
      /// Gets the trade count.
      /// </summary>
      public int Trades
      {
         get { return trades; }
      }
   }
}